package parser

import (
	"fmt"
	"luiz/crawler/engine"
	"regexp"
)

//<a href="http://album.zhenai.com/u/1693313153" target="_blank">醉思恋人</a>
const cityRe = `(http://album.zhenai.com/u/[0-9]+)"[^>]*>([^<]+)`

func ParseCity(contents []byte) engine.ParseResult {
	compile := regexp.MustCompile(cityRe)
	findString := compile.FindAllStringSubmatch(string(contents), -1)
	result := engine.ParseResult{}
	for _, match := range findString {
		result.Items = append(result.Items, match[2])
		result.Request = append(result.Request, engine.Request{Url: match[1], ParserFunc: ParseProfile})
		fmt.Printf("%v %v\n", match[1], "用户: "+match[2])
	}
	fmt.Printf("Matches found: %d\n", len(findString))
	return result
}
